import Main from '@/views/Main.vue';
//管理员权限
let admin = [1,2]
//代理权限
let agent = [3,4,5,6,7]
// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: resolve => { require(['@/views/login.vue'], resolve); }
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => { require(['@/views/error-page/404.vue'], resolve); }
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: resolve => { require(['@//views/error-page/403.vue'], resolve); }
};

export const page500 = {
    path: '/503',
    meta: {
        title: '503-服务端错误'
    },
    name: 'error-503',
    component: resolve => { require(['@/views/error-page/503.vue'], resolve); }
};

// export const preview = {
//     path: '/preview',
//     name: 'preview',
//     component: resolve => { require(['@/views/components/article-publish/preview.vue'], resolve); }
// };

export const locking = {
    path: '/locking',
    name: 'locking',
    component: resolve => { require(['@/views/components/lockscreen/components/locking-page.vue'], resolve); }
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    meta:{title: '首页'},
    children: [
        { path: 'home', meta:{title: '首页'}, name: 'home_index', component: resolve => { require(['@/views/home/home.vue'], resolve); } }
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/personal-center',
        icon: 'android-contact',
        meta:{title: '个人中心'},
        name: 'personalcenter',
        component: Main,
        children: [
            // { path: 'account-overview', meta:{title: '账户概览'}, name: 'account_overview', component: resolve => { require(['@/views/personal-center/account-overview.vue'], resolve); } },
            { path: 'personal-account-change-detailed', meta:{title: '资金变动'}, name: 'personal_account_change_detailed', component: resolve => { require(['@/views/personal-center/personal-account-change-detailed.vue'], resolve); } },
            { path: 'personal-account-pal', meta:{title: '个人盈亏'}, name: 'personal_account_pal', component: resolve => { require(['@/views/personal-center/personal-account-pal.vue'], resolve); } },
            { path: 'recharge-record', meta:{title: '充提记录'}, name: 'recharge_record', access: agent,component: resolve => { require(['@/views/personal-center/recharge-record.vue'], resolve); } },
        ]
    },
    {
        path: '/business-manage',
        icon: 'ios-albums',
        meta:{title: '业务管理'},
        name: 'businessmanage',
        component: Main,
        children: [
            { path: 'recharge-manage', meta:{title: '充值管理'}, name: 'recharge_manage', component: resolve => { require(['@/views/business-manage/recharge-manage.vue'], resolve); } },
            { path: 'reclaim-manage', meta:{title: '提现管理'}, name: 'reclaim_manage', component: resolve => { require(['@/views/business-manage/reclaim-manage.vue'], resolve); } },
            { path: 'account-action', meta:{title: '资金操作'}, name: 'account_action', component: resolve => { require(['@/views/business-manage/account-action.vue'], resolve); } },
            { path: 'current-account', meta:{title: '对账还款'}, name: 'current_account', component: resolve => { require(['@/views/business-manage/current-account.vue'], resolve); } },
            { path: 'user-repayment', meta:{title: '还款历史'}, name: 'user_repayment', component: resolve => { require(['@/views/business-manage/user-repayment.vue'], resolve); } }
        ]
    },
    {
        path: '/reporting-manage',
        icon: 'ios-paper',
        meta:{title: '报表管理'},
        name: 'reportingmanage',
        component: Main,
        children: [
            { path: 'sszd', meta:{title: '时时注单'}, name: 'sszd', component: resolve => { require(['@/views/reporting-manage/sszd.vue'], resolve); } },            
            { path: 'betting-reporting',meta:{title: '投注报表'} , name: 'betting_reporting', component: resolve => { require(['@/views/reporting-manage/betting-reporting.vue'], resolve); } },
            { path: 'finance-reporting', meta:{title: '财务报表'}, name: 'finance_reporting', component: resolve => { require(['@/views/reporting-manage/finance-reporting.vue'], resolve); } },
            { path: 'team-reporting', meta:{title: '团队报表'}, name: 'team_reporting', component: resolve => { require(['@/views/reporting-manage/team-reporting.vue'], resolve); } },
            { path: 'funds-on-account-manage', meta:{title: '账变明细'}, name: 'funds_on_account_manage', component: resolve => { require(['@/views/reporting-manage/funds-on-account-manage.vue'], resolve); } },
        ]
    },
    {
        path: '/user-manage',
        icon: 'ios-people',
        meta:{title: '用户管理'},
        name: 'usermanage',
        component: Main,
        children: [
            { path: 'vip-manage', meta:{title: '用户列表'}, name: 'vip_manage', component: resolve => { require(['@/views/user-manage/vip-manage.vue'], resolve); } },
            // { path: 'usermanage/agent-manage', title: '代理管理', name: 'agent_manage', component: resolve => { require(['@/views/user-manage/agent-manage.vue'], resolve); } },
            { path: 'login-inquire', meta:{title: '登陆查询'}, name: 'login_inquire', component: resolve => { require(['@/views/user-manage/login-inquire.vue'], resolve); } },
            { path: 'user-receivables-manage', meta:{title: '银行信息'}, name: 'user_receivables_manage', component: resolve => { require(['@/views/user-manage/user-receivables-manage.vue'], resolve); } },
        ]
    },
    {
        path: '/lottery-manage',
        icon: 'happy',
        meta:{title: '彩票管理'},
        access: admin,
        name: 'lotterymanage',
        component: Main,
        children: [
            { path: 'lotterytype-manage', meta:{title: '彩种管理'}, name: 'lotterytype_manage', component: resolve => { require(['@/views/lottery-manage/lotterytype-manage.vue'], resolve); } },
            { path: 'odds-setup', meta:{title: '赔率设置'}, name: 'odds_setup', component: resolve => { require(['@/views/lottery-manage/odds-setup.vue'], resolve); } },
            { path: 'sixlottery', meta:{title: '六合彩管理'}, name: 'sixlottery', component: resolve => { require(['@/views/lottery-manage/sixlottery.vue'], resolve); } },
            { path: 'sealing-setup', meta:{title: '预设设置'}, name: 'sealing_setup', component: resolve => { require(['@/views/lottery-manage/sealing-setup.vue'], resolve); } },
            { path: 'open-lottery-inspect', meta:{title: '开奖检测'}, name: 'open_lottery_inspect', component: resolve => { require(['@/views/lottery-manage/open-lottery-inspect.vue'], resolve); } },
            { path: 'open-lottery-data', meta:{title: '开奖数据'}, name: 'open_lottery_data', component: resolve => { require(['@/views/lottery-manage/open-lottery-data.vue'], resolve); } }, 
        ]
    },
    {
        path: '/system-setup',
        icon: 'settings',
        meta:{title: '系统设置'},
        access: admin,
        name: 'systemsetup',
        component: Main,
        children: [
            { path: 'admin-operation', meta:{title: '参数设置'}, name: 'admin_operation', component: resolve => { require(['@/views/system-setup/admin-operation.vue'], resolve); } },
            // { path: 'site-setup', meta:{title: '优惠活动'}, name: 'site_setup', component: resolve => { require(['@/views/system-setup/site-setup.vue'], resolve); } },
            // { path: 'log-manage', meta:{title: '系统日志'}, name: 'log_manage', component: resolve => { require(['@/views/system-setup/log-manage.vue'], resolve); } },
            { path: 'advert-manage', meta:{title: '公告管理'}, name: 'advert_manage', component: resolve => { require(['@/views/system-setup/advert-manage.vue'], resolve); } },
            { path: 'help', meta:{title: '帮助中心'}, name: '_help', component: resolve => { require(['@/views/system-setup/help.vue'], resolve); } },
            { path: 'play-help', meta:{title: '玩法说明'}, name: 'play_help', component: resolve => { require(['@/views/system-setup/play-help.vue'], resolve); } },//html文档
            { path: '/app-carousel', meta:{title: 'APP轮播'}, name: 'app_carousel', component: resolve => { require(['@/views/system-setup/app-carousel.vue'], resolve); } },
        ]
    },
    // {
    //     path: '/other-setup',
    //     icon: 'social-dropbox',
    //     meta:{title: '其他设置'},
    //     access: admin,
    //     name: 'othersetup',
    //     component: Main,
    //     children: [
    //         // { path: 'othersetup/fd', meta:{title: '飞单功能'}, name: 'fd', component: resolve => { require(['@/views/other-setup/fd.vue'], resolve); } },
    //         { path: 'risk-ranking', meta:{title: '风险排行'}, name: 'risk_Ranking', component: resolve => { require(['@/views/other-setup/risk-ranking.vue'], resolve); } },
    //         { path: 'hero-ranking', meta:{title: '盈亏排行'}, name: 'Hero_Ranking', component: resolve => { require(['@/views/other-setup/hero-ranking.vue'], resolve); } },
    //         { path: 'feedback', meta:{title: '投诉与意见'}, name: '_feedback', component: resolve => { require(['@/views/other-setup/feedback.vue'], resolve); } },
    //     ]
    // }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    // preview,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];
